/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bolao.ui.converters;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

/**
 *
 * @author 002824992500
 */
@ManagedBean
@ViewScoped
public class ConverterStorageBean implements Serializable {

    private List entities = new ArrayList();

    public String addEntity(Object obj) {
        int index = entities.indexOf(obj);
        if (index == -1) { // Objeto ainda não incluído na lista
            entities.add(obj);
            index = entities.size() - 1;
        }
        return String.valueOf(index);
    }

    public Object getEntity(String index) {
        return entities.get(new Integer(index));
    }
}
